import { FormGroup } from "@angular/forms";
import { debugLog } from "./log";

export const formValid = (form: FormGroup): boolean => {
  let flag = true
  let controls = form.controls;
  for (let i in controls) {
    controls[i].markAsTouched();
    controls[i].updateValueAndValidity();
  }

  for(let i in controls){
    if(controls[i].invalid){
      debugLog(controls)
      flag = false
    }
  }
  return flag
}